﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Join : System.Web.UI.Page
{
    int type;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string id = Request.QueryString["get"];
            if (id.Equals("c")) { 
                Label1.Text = "Contact";
                type = 1;//if is contact
            }
            else { Label1.Text = "Join Crew"; 
                type = 2;//if is vendor
            }
        }
        catch (Exception ex) { Label1.Text = "Contact"; }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {

    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        if (email.Text == "")
        {


        }
        else {
            if (type == 1)//if contact
            {
                string body;
                body = "<table border=\"1\" align=\"center\" width='500'> <tr><td bgcolor=\"#B2B2B2\" colspan=\"2\" ><h2>Contact</h2></td></tr>";
                body=  body +" <tr><td>Name</td><td>" + name.Text + "</td></tr>";
                body = body + "<tr><td>Address1</td><td>" + address1.Text + "</td></tr>";
                body = body + "<tr><td>Address2</td><td>" + address2.Text + "</td></tr>";
                body = body + "<tr><td>City</td><td>" + city.Text + "</td></tr>";
                body = body + "<tr><td>State</td><td>" + cbPState.Text + "</td></tr>";
                body = body + "<tr><td>Zip</td><td>" + zip.Text + "</td></tr>";
                body = body + "<tr><td>PhoneNumber</td><td>" + phonenumber.Text + "</td></tr>";
                body = body + "<tr><td>CellPhone</td><td>" + cellphone.Text + "</td></tr>";
                body = body + "<tr><td>Email Address</td><td>" + email.Text + "</td></tr>";
                body = body + "<tr><td>Topic</td><td>" + question.Text + "</td></tr>";
                body = body + "<tr width='500'><td width='500'>Message</td><td>" + message.Text + "</td></tr>";
                body = body + "</table>";
                
                Utility.sendMail("contact@bpophotos.com", "contact@bpophotos.com", "Question Contact Page", body,"");
                

            }
            else { //if join crew
                string body;
                body = "<table border=\"1\" align=\"center\" width='700'> <tr><td bgcolor=\"#B2B2B2\" colspan=\"2\"  ><h2>Join</h2></td></tr>";
                body = body + " <tr><td>Name</td><td>" + name.Text + "</td></tr>";
                body = body + "<tr><td>Address1</td><td>" + address1.Text + "</td></tr>";
                body = body + "<tr><td>Address2</td><td>" + address2.Text + "</td></tr>";
                body = body + "<tr><td>City</td><td>" + city.Text + "</td></tr>";
                body = body + "<tr><td>State</td><td>" + cbPState.Text + "</td></tr>";
                body = body + "<tr><td>Zip</td><td>" + zip.Text + "</td></tr>";
                body = body + "<tr><td>PhoneNumber</td><td>" + phonenumber.Text + "</td></tr>";
                body = body + "<tr><td>CellPhone</td><td>" + cellphone.Text + "</td></tr>";
                body = body + "<tr><td>Email Address</td><td>" + email.Text + "</td></tr>";
                body = body + "<tr><td>Topic</td><td>" + question.Text + "</td></tr>";
                body = body + "<tr width='700'><td width='700'>Message</td><td>" + message.Text + "</td></tr>";
                body = body + "</table>";
                Utility.sendMail("newvendor@bpophotos.com", "newvendor@bpophotos.com", "Question Join Page", body,"");
            
            }
            
            Response.Redirect("Message.aspx");
        }
    }
}
